package com.zhss.demo.redisson;

import org.redisson.api.RCountDownLatch;
import org.redisson.api.RedissonClient;

public class CountDownLatchDemo {
    public static void main(String[] args) throws Exception {
        RedissonClient redisson = RedissionHelp.getRedissionClient();
        RCountDownLatch latch = redisson.getCountDownLatch("anyCountDownLatch");
        new Thread(() -> {
            RedissionHelp.wait(latch, redisson);
        }).start();
        latch.trySetCount(1);
        latch.await();

        // 在其他线程或其他JVM里
//        RCountDownLatch latch = redisson.getCountDownLatch("anyCountDownLatch");
//        latch.countDown();
    }
}
